	/********************************************************/
	/*                                                      */
	/*                                                      */
	/*         Copyright (C), 1993  SEIKO EPSON Corp.       */
	/*         ALL RIGHTS RESERVED                          */
	/*                                                      */
	/*                                                      */
	/*  file name : scanf.c                                 */
	/*                                                      */
	/*  Revision history                                    */
	/*      93/12/17    first release       K.Shinozuka     */
    	/*      97/3/17	    modified	    	T.Katahira      */
    	/*		change function declaration	    	*/
    	/*				to the ANSI style   	*/
	/*                                                      */
	/********************************************************/

#ifdef    UNIX
#include    "stdio.h"
#include    "stdarg.h"
#include    "smcvals.h"
#else
#include    <stdio.h>
#include    <stdarg.h>
#include    <smcvals.h>
#endif
 
extern int _doscan( /* _CODETYP, FILE *, unsigned char *, va_list */ );
 
#if defined( UNIX ) && !defined( ANSI )   /* for not ANSI C compiler */
int
scanf( va_alist )
va_dcl

#else
int
scanf( const char *cFmtP, ... )
/*  const char    *cFmtP;            pointer to the format string */

#endif

	/********************************************************/
	/*                                                      */
	/*  The scanf function reads formatted data from the    */
	/*  standard input. The reading of the input is         */
	/*  controlled by the input format ( cFmtP ) which      */
	/*  specifies the input sequences and the conversion    */
	/*  for assignment to the address pointed to by         */
	/*  subsequent arguments.                               */
	/*  The format is composed of zero or more directives:  */
	/*  one or more white-space characters; ordinary        */
	/*  single byte characters ( not % ); and conversion    */
	/*  specifications, each of which is started with the   */
	/*  character %.                                        */
	/*  About the specification of the conversion, please   */
	/*  read READMEstdio.                                   */
	/*  The scanf function returns when the end of the      */
	/*  format string is reached, when the end of the input */
	/*  file is reached, or when the input fails to match   */
	/*  a directives in the format string, whichever occurs */
	/*  first.  If the format is exhausted while arguments  */
	/*  remain, the excess arguments are evaluated but not  */
	/*  converted.                                          */
	/*                                                      */
	/*  The scanf doesn't have following functions, which   */
	/*  prescribed in ANSI.                                 */
	/*                                                      */
	/*     1) p conversion                                  */
	/*     2) n conversion                                  */
	/*     3) [] conversion                                 */
	/*     4) treatment with long double values             */
	/*        ( L option )                                  */
	/*     5) limitation of character in the format         */
	/*          ANSI allows to use multibyte character      */
	/*          sequence, but we limit it only single byte  */
	/*          characters.                                 */
	/*                                                      */
	/*  note 1: In case of hexadecimal conversion (i, x, X) */
	/*          0x or 0X should be used with numerical      */
	/*          characters.                                 */
	/*            0x123   ... correct                       */
	/*            0xyz  ( sequence of '0' and "xyz" )       */
	/*             ----> conversion will be terminated at y */
	/*  note 2: Fractional expression and character 'e'/'E',*/
	/*          or error at exponential expression (missing */
	/*          numerical character) is not allowed in      */
	/*          floating point conversion.                  */
	/*            1.234     ... correct                     */
	/*            1.23e123  ... correct                     */
	/*            1.23ea ( sequence of '1.23' and 'ea' )    */
	/*            1.23e- ( error at exponential expression )*/
	/*              ---> conversion will be terminated      */
	/*                     at 'a' or '-'                    */
	/*                                                      */
	/*      RETURN  except EOF  ... the number of input     */
	/*                              items assigned          */
	/*              EOF         ... Error                   */
	/*                              an input failure occurs */
	/*                              before any conversion   */
	/*                                                      */
	/********************************************************/

    {
	 va_list tdArgP    ;         /* pointer to the list of the variable numbers of argument */

#if defined( UNIX ) && !defined( ANSI )
	 char    *cFmtP;             /* pointer to the format string */
	 va_start( tdArgP );
	 cFmtP = va_arg( tdArgP, char * );
#else
	 va_start( tdArgP, cFmtP );  /* set the first address of the variable numbers of argument */
#endif

	 return( _doscan( _STRM, stdin, cFmtP, tdArgP ) );  /* get strings, convert and assign */
    }

